package nimble.unionpay.openapi;

import org.apache.commons.lang3.StringUtils;

public enum CardProduct {

    UNKNOWN("00","未知"),
    GOVERNMENT_CARD("01","公务卡"),
    PUBLIC_PAYMENT_CARD("02","公共缴费类卡"),
    AIR_CARD("03","航空卡"),
    STUDENT_CARD("04","学生卡"),
    SOCIAL_SECURITY_CARD("05","社保卡"),
    TRANSPORTATION_CARD("06","交通卡"),
    POINT_CARD("07","积分卡"),
    MILITARY_CARD("08","军人卡"),
    CITIZEN_CARD("09","市民卡"),
    BUSINESS_CARD("10","商务卡"),
    TRAVEL_CARD("11","旅游卡");

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    CardProduct(String code,String desc)
    {
        this.code=code;
        this.desc=desc;
    }

    public static CardProduct parse(String code)
    {
        for(CardProduct cardProduct:CardProduct.values())
        {
            if(StringUtils.equalsAny(code,cardProduct.name(),cardProduct.getCode()))
            {
                return cardProduct;
            }
        }
        return null;
    }
}
